package com.kerrykidz.filemanagement.service.impl;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.kerrykidz.filemanagement.service.ISalesService;
import com.kerrykidz.system.dao.mapper.SecUsrEntityMapper;
import com.kerrykidz.system.dao.model.SecUsrEntity;
import com.kerrykidz.system.util.UserUtil;
import com.kerrykidz.system.vo.UserInfo;

@Service
public class SalesServiceImpl implements ISalesService {

	@Autowired
	private SecUsrEntityMapper secUsrEntityMapper; 
	
	/**
	 * 获取所有有销售角色的用户
	 * @return
	 */
	@Override
	public List<SecUsrEntity> listSales() {
		return secUsrEntityMapper.listSales();
	}
	
	/**
	 * 根据 角色id，获取所有相关角色的用户列表 
		 * @Description   
		 * List<SecUsrEntity>
		 * @author chenyu
		 * 2014年8月22日 下午2:17:55
	 */
	public List<SecUsrEntity> listUserByRoleId(String roleId){
		UserInfo user = UserUtil.getUserFromSession();
		String fkBrandId =user.getBranId();
		if(user.getAbbrCode().equals("ZB")){
			fkBrandId ="";
		}
		return secUsrEntityMapper.listUserByRoleId(roleId,fkBrandId);
	}

}
